import { BasicPageParams, BasicFetchResult } from '@/api/model/baseModel';

export interface ServerInfo {
  id: number;
  name: string;
  auth_type: number; // 1-ssh密码，2-ssh秘钥，3-rsync(需要密码)
  ip: string;
  port: number;
  username: string;
  password?: string; // SSH密码或RSYNC密码,可选
  key?: string; // SSH私钥内容,可选
  status: number; // 10代表active，20代表inactive
}

export interface ServerParams extends BasicPageParams {
  name?: string;
  auth_type?: number;
  status?: number;
}

export interface ServerListGetResultModel extends BasicFetchResult<ServerInfo> {}

// Request Types
export interface ServerAddReq {
  name: string;
  auth_type: number; // 1-ssh密码，2-ssh秘钥，3-rsync(需要密码)
  ip: string;
  port: number;
  username: string;
  password?: string; // SSH密码或RSYNC密码,新增时可选
  key?: string; // SSH私钥内容(仅auth_type=2时需要),可选
  status: number;
}

export interface ServerEditReq extends Omit<ServerAddReq, 'password'> {
  id: number;
  password?: string; // 编辑时密码可选,不传则保持原密码不变
}

export interface ServerDelReq {
  id: number;
}
